<!--
 * @Autor: Kadia
 * @Date: 2021-07-01 08:17:52
 * @LastEditors: Kadia
 * @Connect: nefukadia@foxmail.com
 * @LastEditTime: 2021-07-02 18:08:37
-->
<template>
    <div v-if="prepare">
        <my-menu active="2" :hasLogin="true"></my-menu>
        <div class="min-div">
            <el-tabs style="width:80%;margin:0 auto;" :tab-position="'left'" v-model="tabIndex">
                <el-tab-pane lazy label="接单大厅">
                    <my-order></my-order>
                </el-tab-pane>
                <el-tab-pane lazy label="已接单">
                    <my-task></my-task>
                </el-tab-pane>
                <el-tab-pane lazy label="已完成">
                    <my-finish></my-finish>
                </el-tab-pane>
            </el-tabs>
        </div>
        <my-footer></my-footer>
    </div>
</template>
<script>
import myFinish from './compoents/myFinish.vue';
import myOrder from './compoents/myOrder';
import myTask from './compoents/myTask.vue';
export default {
  components: { myOrder,myTask, myFinish },
    data(){
        return {
            tabIndex:'0',
            prepare:false
        }
    },
    created () {
        const that=this;
        if(that.$cookies.get('email')!=null&&that.$cookies.get('password')!=null){
            that.$axios({
                url:that.myConfig.manageApiUrl+'/login.php',
                method:'post',
                data:{
                    email:that.$cookies.get('email'),
                    password:that.$cookies.get('password')
                }
            }).then(function(res){
                that.prepare=true;
                if(res.data.errCode==200){
                    that.myConfig.shopId=res.data.shopId;
                }else{
                    that.$cookies.remove('email');
                    that.$cookies.remove('password');
                    that.$router.push({
                        name:'Index'
                    });
                }
            }).catch(function(err){
                that.prepare=false;
                that.$router.push({
                    name:'Index'
                });
            });
        }else{
            that.$router.push({
                name:'Index'
            });
        }
    }
}
</script>
<style scoped>

</style>